<template>
  <div class="nameEdit-container">
    <van-field v-model="nameValue" label="昵称" placeholder="请输入新昵称"></van-field>
    <van-button slot="button" size="small" type="default" @click="postName">提交</van-button>
  </div>
</template>

<script>
export default {
  name: 'NameEdit',
  props: {},
  data() {
    return {
      nameValue: ''
    }
  },
  methods: {
    postName() {
      if (this.nameValue) {
        this.$emit('changeName', this.nameValue)
        this.$emit('close')
      }
    }
  }
}
</script>

<style scope lang="less">
.nameEdit-container {
  padding: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  .van-field {
    background-color: #f3f4f5;
  }
  .van-button {
    width: 150px;
    height: 60px;
    margin-left: 20px;
  }
}
</style>
